$(document).ready(function() {

	function getUrlParam(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if (r != null) return unescape(r[2]); return null;
	}
	
	$('#btn_reg_confirm').on('click', function() {

		$.ajax({
			url : '/doApprove?key=' + getUrlParam('key'),
			type : 'get',
			contentType : 'application/json;charset=utf-8',
			data : {},
			timeout : 5000,
			dataType : 'json',
			success : function(data, textStatus) {
				
				if(data.code == 1){
					
					window.location.href="/index.html";
				}else{

				}

			},
			error : function(xhr, textStatus) {
				console.log(xhr)
				console.log(textStatus)
			}
		})
	});
});